
function init(name) {
    name=name?name:'home'
    $.get('./js/data/'+name+'.json', function (data) {
        
    first(data.first);
    second(data.second);
    third(data.third);
    four(data.four);
    five(data.five);
    six(data.six);
    seven(data.seven);
    topNum(data.top);

    })
}
function topNum(d){
    let li='';
   
    for(let i of d){
        li+='<li>'+i+'</li>'
    }

    document.querySelector('#showNum').innerHTML=li


}
function rndNumArr(n,t){
    var rnd=[];
    for(var i=0;i<n;i++)
        rnd[i] =parseInt(Math.random()*t);
    return rnd;
}
function randomNumber(t){
   return parseInt(Math.random()*t)
}
function third(data) {
    let myChart = echarts.init(document.querySelector(".bar_industry .chart"));
    let option = {
        color: ['#2f89cf'],
        tooltip: {
            trigger: 'axis',
            axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
            },
            formatter: '{a} <br/>{b}: {c}个'
        },
        grid: {
            left: '0%',
            top: 10,
            bottom: '4%',
            containLabel: true
        },
        xAxis: [
            {
                type: 'category',
                data: data.xAxis.data,
                axisTick: {
                    alignWithLabel: true
                },
                axisLabel: {
                    color: "rgba(255,255,255,.6)",
                    fontSize: 12,
                    interval: 0,
                    rotate: 30,
                },
                axisLine: {
                    show: false
                }
            }
        ],
        yAxis: [
            {
                type: 'value',
                axisLabel: {
                    color: "rgba(255,255,255,.6)",
                    fontSize: 12,
                },
                axisLine: {
                    lineStyle: {
                        color: "rgba(255,255,255,.1)"
                    }
                },
                splitLine: {
                    lineStyle: {
                        color: "rgba(255,255,255,.1)"
                    }
                }
            }
        ],
        series: [
            {
                name: '隐患数量',
                type: 'bar',
                barWidth: '35%',
                data: data.series
                // itemStyle:{
                //     barBorderRadius:5
                // }
            }
        ],
    };
    myChart.setOption(option);
    window.addEventListener("resize", function () {
        myChart.resize();
    });
    myChart.on('click', function () {
        location.href = '/echarts/zyzy/index.html'
    })
}



function four(data) {
    let myChart = echarts.init(document.querySelector(".bar_skill .chart"));
    let myColor = ["#4085d3", "#F57474", "#56D0E3", "#F8B448", "#8B78F6","#cbe86b","#3ac569"];
    let option = {
        color: myColor,//['#74A6F2', '#F6B54B',],
        tooltip: {
            trigger: 'item',
            formatter: '{b}：{d}%'
        },
        legend: {
            // orient:'vertical',
            itemWidth:15,
            itemHeight:8,
            // x: 'right',
            y:'bottom',
            textStyle: {
                color: '#fff',
                fontSize: 10
            }
        },
        series: [
            {
                name: '数量',
                type: 'pie',
                radius: '60%',
                center: ["50%", "40%"], 
                data: data.series.data,
                label: {
                    show: true,
                    position: 'outside',
                    formatter: function(p){
                        // console.log(p)
                        return p.data.value+'个'
                    }
                },
                labelLine: {
                    show: true
                },
                emphasis: {
                    itemStyle: {
                        shadowBlur: 10,
                        shadowOffsetX: 0,
                        shadowColor: 'rgba(0, 0, 0, 0.5)'
                    }
                }
            }
        ]
    };
    myChart.setOption(option);
    window.addEventListener("resize", function () {
        myChart.resize();
    });
    myChart.on('click', function () {
        location.href = '/echarts/rq/index.html'
    })
}


function second(data) {
    let month = [
        ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
        ['1月', '2月', '3月', '4月', '5月', '6月']
    ];
    let myChart = echarts.init(document.querySelector(".line_staff .chart"));
    let colors = ['#5793f3', '#d14a61'];
    let option = {
        color: colors,
        tooltip: {
            trigger: 'axis',
            formatter: function (params) {
                let str = params[0].name + '<br/>'
                params.forEach((item) => {
                    str +=
                    item.marker +
                    item.seriesName +
                    '：' +
                    item.value +
                    '个<br/>'
                })
                return str
            },
        },
        legend: {
            textStyle: {
                color: 'rgba(255,255,255,0.7)' // 图例文字颜色
            },
            right: '10%' // 距离右边10%
        },
        grid: {
            top: '20%',
            left: '3%',
            right: '4%',
            bottom: '3%',
            show: true,// 显示边框
            borderColor: '#012f4a',// 边框颜色
            containLabel: true // 包含刻度文字在内
        },
        xAxis: {
            type: 'category',
            axisTick: {
                show: false
            },
            axisLine: {
                show: false,// 去除轴线
                lineStyle: {
                    color: colors[0]
                }
            },
            boundaryGap: false, // 去除轴内间距
            axisPointer: {
                label: {
                    formatter: function (params) {
                        return  params.value
                            + (params.seriesData.length ? '：' + params.seriesData[0].data : '');
                    }
                }
            },
            data:['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
        },
        yAxis: [
            {
                type: 'value',
                axisTick: {
                    show: false  // 去除刻度
                },
                axisLabel: {
                    color: 'rgba(255,255,255,0.7)', // 文字颜色

                },
                splitLine: {
                    lineStyle: {
                        color: '#012f4a' // 分割线颜色
                    }
                }
            }
        ],
        series: data.series
    };
    myChart.setOption(option);
    // let year = document.querySelectorAll(".title a")
    // for (let i = 0; i < year.length; i++) {
    //     year[i].addEventListener("click", function () {
    //         option.series[0].data = yearData[i].data[0];
    //         option.series[1].data = yearData[i].data[1];
    //         option.xAxis[0].data = month[i]
    //         option.xAxis[1].data = month[i]
    //         myChart.setOption(option);
    //     });
    // }

    window.addEventListener("resize", function () {
        myChart.resize();
    });
}

function five(data) {
    let myChart = echarts.init(document.querySelector(".line_flow .chart"));
    let option = {
        color: ['#74A6F2', '#1CE7DC', '#F6B54B', '#EF702E', '#EC342F'],
        tooltip: {
            trigger: 'axis',
            formatter: function (params) {
                let str = params[0].name + '<br/>'
                params.forEach((item) => {
                    str +=
                        item.marker +
                        item.seriesName +
                        '：' +
                        item.value +
                        '立方米/秒<br/>'
                })
                return str
            },
        },
        legend: {
            icon: 'rect',
            itemWidth: 15,
            itemHeight: 5,
            itemGap: 10,
            textStyle: {
                color: '#fff',
                fontSize: 12
            },
            data: data.legend
        },
        grid: {
            top: '25%',
            left: '3%',
            right: '6%',
            bottom: '3%',
            containLabel: true
        },
        xAxis: {
            type: 'category',
            boundaryGap: false,
            data: data.xAxis,
            //不显示y轴线条
            axisLine: {
                show: false
            },
            // 不显示刻度
            axisTick: {
                show: false
            },
            axisLabel: {
                color: "#fff"
            },
            splitLine: {
                show: false
            }
        },
        yAxis: {
            type: 'value',
            //不显示y轴线条
            axisLine: {
                show: false
            },
            // 不显示刻度
            axisTick: {
                show: false
            },
            axisLabel: {
                color: "#fff"
            },
            splitLine: {
                show: false
            }
        },
        series: data.series
    };
    myChart.clear();
    myChart.setOption(option);
    window.addEventListener("resize", function () {
        myChart.resize();
    });
    myChart.on('click', function () {
        location.href = '/echarts/sl/index.html'
    })
}


function first(data) {
    let myChart = echarts.init(document.querySelector(".pie_age .chart"));
    let option = {
        color: ['#74A6F2', '#1CE7DC', '#F6B54B', '#EF702E', '#EC342F'],

        tooltip: {
            trigger: 'item',
            formatter: '{a} <br/>{b}: {c}个 ({d}%)'
        },
        legend: { 
            // 距离底部为0%
            bottom: "0%",
            // 小图标的宽度和高度
            itemWidth: 10,
            itemHeight: 10,
            data: data.legend,
            // 修改图例组件的文字为 12px
            textStyle: {
                color: "rgba(255,255,255,.5)",
                fontSize: "12"
            }
        },
        series: [
            {
                name: "隐患分布",
                type: "pie",
                // 设置饼形图在容器中的位置
                center: ["50%", "40%"],
                //  修改内圆半径和外圆半径为  百分比是相对于容器宽度来说的
                radius: ["40%", "60%"],
                label: {
                    show: true,
                    formatter: ' ({d}%)'
                },
                labelLine: {
                    show: true
                },
                data: data.data,
            }
        ]
    };
    myChart.setOption(option);
    window.addEventListener("resize", function () {
        myChart.resize();
    });
    myChart.on('click', function () {
        location.href = '/echarts/yj/index.html'
    })
}





function six(data) {
    let myChart = echarts.init(document.querySelector(".pie_area .chart"));
    let option = {
        color: ['#74A6F2', '#1CE7DC', '#F6B54B', '#EF702E', '#EC342F'],
        tooltip: {
            trigger: 'axis',
            formatter: function (params) {
                let str = params[0].name + '<br/>'
                params.forEach((item) => {
                    str +=
                        item.marker +
                        item.seriesName +
                        '：' +
                        item.value +
                        'ug/m3<br/>'
                })
                return str
            },
        },
        legend: {
            icon: 'rect',
            itemWidth: 15,
            itemHeight: 5,
            itemGap: 10,
            textStyle: {
                color: '#fff',
                fontSize: 12
            },
            data: data.legend
        },
        grid: {
            top: '15%',
            left: '3%',
            right: '6%',
            bottom: '3%',
            containLabel: true
        },
        xAxis: {
            type: 'category',
            boundaryGap: false,
            data: data.xAxis.data,
            //不显示y轴线条
            axisLine: {
                show: false
            },
            // 不显示刻度
            axisTick: {
                show: false
            },
            axisLabel: {
                color: "#fff"
            },
            splitLine: {
                show: false
            }
        },
        yAxis: {
            type: 'value',
            max: 220,
            interval: 44,
            //不显示y轴线条
            axisLine: {
                show: false
            },
            // 不显示刻度
            axisTick: {
                show: false
            },
            axisLabel: {
                color: "#fff"
            },
            splitLine: {
                show: false
            }
        },
        series: data.series
    };
    myChart.setOption(option);
    window.addEventListener("resize", function () {
        myChart.resize();
    });
    myChart.on('click', function () {
        location.href = '/echarts/hb/index.html'
    })
}


function seven(data) {
    let myChart = echarts.init(document.getElementById("safety-sort"));
    let option = {
        color: ['#2f89cf'],
        tooltip: {
            trigger: 'axis',
            axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
            },
            formatter: '{a} <br/>{b}: {c}个'
        },
        grid: {
            left: '4%',
            top: 10,
            right: '4%',
            bottom: '4%',
            containLabel: true
        },
        xAxis: [
            {
                type: 'category',
                data: data.xAxis.data,
                axisTick: {
                    alignWithLabel: true
                },
                axisLabel: {
                    color: "rgba(255,255,255,.6)",
                    fontSize: 12,
                },
                axisLine: {
                    show: false
                }
            }
        ],
        yAxis: [
            {
                type: 'value',
                axisLabel: {
                    color: "rgba(255,255,255,.6)",
                    fontSize: 12,
                },
                axisLine: {
                    lineStyle: {
                        color: "rgba(255,255,255,.1)"
                    }
                },
                splitLine: {
                    lineStyle: {
                        color: "rgba(255,255,255,.1)"
                    }
                }
            }
        ],
        series: [
            {
                name: '隐患数量',
                type: 'bar',
                barWidth: 60,
                data: data.series
            }
        ],
    };
    myChart.setOption(option);
    window.addEventListener("resize", function () {
        myChart.resize();
    });
}
middelMap();

function middelMap() {

    let myChart = echarts.init(document.querySelector(".map .chart"));
    let tt='';
    function initData(text) {
      let  t = text ? text : 'luojiang';
      tt=text;
        $.get('./js/map/' + t + '.json', function (geoJson) {

            echarts.registerMap('LJ', geoJson);
            let itemStyle = {
                normal: {
                    borderColor: '#00d887',
                    borderWidth: 2,
                    shadowBlur: 10,
                    areaColor: 'rgba(58, 244, 240, 0.3)',
                },
                emphasis: {
                    areaColor: 'rgba(120,152,225, 0.8)',
                },
            }


            function coordSwitch(strDu, strFen, strMiao, len) {
                len = (len > 6 || typeof (len) == "undefined") ? 6 : len;//精确到小数点后最多六位   
                strDu = (typeof (strDu) == "undefined" || strDu == "") ? 0 : parseFloat(strDu);
                strFen = (typeof (strFen) == "undefined" || strFen == "") ? 0 : parseFloat(strFen) / 60;
                strMiao = (typeof (strMiao) == "undefined" || strMiao == "") ? 0 : parseFloat(strMiao) / 3600;
                var digital = strDu + strFen + strMiao;
                if (digital == 0) {
                    return "";
                } else {
                    return digital.toFixed(len);
                }
            }

            var markPointData = {
                '金山镇': [
                    // 地质灾害
                    {name: '金山镇马驰村2组兰登万屋后滑坡', coord: [coordSwitch(104, 30, 50.10), coordSwitch(31,25, 43.31)], itemStyle: {normal: {color: colors.dzzh}}, },
                    {name: '金山镇安家村7组松树山梁子滑坡', coord: [coordSwitch(104,32,10.57), coordSwitch(31,25,43.14)], itemStyle: {normal: {color: colors.dzzh}}, },

                    //水库
                    {name: '彭家坝(金山镇马驰村)', coord: [104.52073, 31.428241],itemStyle: {normal: {color: colors.sk}}, },
                    {name: '罗家湾(金山镇罗家湾村)', coord: [104.56077, 31.400260],itemStyle: {normal: {color: colors.sk}}, },
                    {name: '石庙子(金山镇谭家坝村)', coord: [104.59761,31.346288],itemStyle: {normal: {color: colors.sk}}, },
                    {name: '张家湾(金山镇金山社区)', coord: [104.56122,31.376337],itemStyle: {normal: {color: colors.sk}}, },
                    // 山洪
                    {name: '金山镇(凯江黄水河水系二龙沟)', coord: ["104.602222","31.331111"], itemStyle: {normal: {color: colors.sh}}, },
                    {name: '金山镇(黄水河支沟)', coord: ["104.625556","31.338056"], itemStyle: {normal: {color: colors.sh}}, },
                    {name: '金山镇(黄水河)', coord: ["104.553333","31.401111"], itemStyle: {normal: {color: colors.sh}}, },
                    {name: '金山镇(秀水河支沟)', coord:["104.521111","31.418333"], itemStyle: {normal: {color: colors.sh}}, },
                    {name: '金山镇(黄水河支沟)', coord:["104.501667","31.394167"], itemStyle: {normal: {color: colors.sh}}, },
                    {name: '金山镇(黄水河)', coord: ["104.509722","31.334167"],itemStyle: {normal: {color: colors.sh}}, },

                    // 水电站
                    {name: '百宝电站(金山镇谭家坝村)', coord: [104.5697584644,31.3653114475], itemStyle: {normal: {color: colors.sdz}}, },
                    {name: '骑龙电站(金山镇谭家坝村)', coord: [104.5698618364,31.3926766717], itemStyle: {normal: {color: colors.sdz}}, },

                ],
                '白马关镇': [
                    // 地质灾害
                    {name: '白马关镇三叉河村3组谢文保房前滑坡', coord: [coordSwitch(104,25,43.60), coordSwitch(31,18,9.55)], itemStyle: {normal: {color: colors.dzzh}}, },
                    {name: '白马关镇凤雏村10组曾奋菊房后滑坡', coord: [coordSwitch(104,28,11.22), coordSwitch(31,18,22.58)], itemStyle: {normal: {color: colors.dzzh}}, },

                    //水库
                    {name: '万佛寺(白马关镇万佛村)', coord: [104.46519,31.265859],itemStyle: {normal: {color: colors.sh}}, },
                    {name: '玉溪湖(白马关换马村)', coord: [104.46718,31.329702],itemStyle: {normal: {color: colors.sk}}, },
                    // 山洪
                    {name: '白马关镇(沱江流域广济桥山洪沟)', coord:  ["104.440000","31.270000"], itemStyle: {normal: {color: colors.sh}}, },
                    {name: '白马关镇(凯江支沟)', coord: ["104.537222","31.243056"], itemStyle: {normal: {color: colors.sh}}, },
                    {name: '白马关镇(凯江支沟)', coord:["104.516667","31.248611"], itemStyle: {normal: {color: colors.sh}}, },
                    {name: '白马关镇(凯江支沟)', coord: ["104.534167","31.238333"], itemStyle: {normal: {color: colors.sh}}, },

                    // 水电站
                    {name: '华龙水电站(白马关镇海棠村)', coord: [104.520303803,31.2538328891],  itemStyle: {normal: {color: colors.sdz}}, },
                ],
                '万安镇': [
                    // 地质灾害
                    {name: '万安镇长虹村7组万宝路边崩塌', coord: [coordSwitch(104,29,45.29), coordSwitch(31,16,44.91)], itemStyle: {normal: {color: colors.dzzh}}, },
                    {name: '万安镇长虹村6组唐水金房后滑坡', coord: [coordSwitch(104,30,7.47), coordSwitch(31,17,10.92)], itemStyle: {normal: {color: colors.dzzh}}, },

                    //水库
                    {name: '牛角堰(万安镇响石社区)', coord: [104.54110,31.331626],itemStyle: {normal: {color: colors.sk}}, },
                    {name: '兴　隆(万安镇华兴村)', coord: [104.59425,31.310473],itemStyle: {normal: {color: colors.sk}}, },
                    {name: '五里堆(万安镇凯江社区)', coord: [104.51941,31.324863],itemStyle: {normal: {color: colors.sk}}, },

                    // 山洪
                    {name: '万安镇(凯江)', coord:["104.484444","31.330000"], itemStyle: {normal: {color: colors.sh}}, },
                    {name: '万安镇(凯江)', coord: ["104.488333","31.338333"], itemStyle: {normal: {color: colors.sh}}, },
                    {name: '万安镇(凯江)', coord:["104.487778","31.333611"], itemStyle: {normal: {color: colors.sh}}, },
                    {name: '万安镇(芙蓉溪河)', coord: ["104.487778","31.333611"], itemStyle: {normal: {color: colors.sh}}, },
                    {name: '万安镇(黄水河)', coord: ["104.562222","31.490278"], itemStyle: {normal: {color: colors.sh}}, },
                    {name: '万安镇(万寿桥)', coord: ["104.574722","31.330833"], itemStyle: {normal: {color: colors.sh}}, },
                    {name: '万安镇(黄水河)', coord: ["104.535000","31.331111"], itemStyle: {normal: {color: colors.sh}}, },

                    // 水电站
                ],
                '略坪镇': [
                    // 地质灾害
                    {name: '略坪镇建国村天台寺滑坡', coord: [coordSwitch(104,24,29.58), coordSwitch(31,19,38.60)], itemStyle: {normal: {color: colors.dzzh}}, },
                    {name: '略坪镇建国村8组蔡家大院滑坡', coord: [coordSwitch(104,22,9.83), coordSwitch(31,20,7.98)], itemStyle: {normal: {color: colors.dzzh}}, },

                    //水库

                    // 山洪
                    {name: '略坪镇(绵远河)', coord: ["104.428056","31.366667"], itemStyle: {normal: {color: colors.sh}}, },
                    {name: '略坪镇(绵远河)', coord: ["104.403333","31.328889"], itemStyle: {normal: {color: colors.sh}}, },
                    {name: '略坪镇(绵远河)', coord: ["104.412778","31.311389"], itemStyle: {normal: {color: colors.sh}}, },
                    {name: '略坪镇(凯江)', coord:  ["104.418056","31.370278"], itemStyle: {normal: {color: colors.sh}}, },

                    // 水电站
                ],
                '调元镇': [
                    // 地质灾害
                    {name: '调元镇三渔村三组陈明友房后崩塌', coord: [coordSwitch(104,26,58.89), coordSwitch(31,21,16.14)], itemStyle: {normal: {color: colors.dzzh}}, },

                    //水库
                    {name: '砚台石(调元镇百花村)', coord: [104.47740,31.377689],itemStyle: {normal: {color: colors.sk}}, },

                    // 山洪
                    {name: '调元镇(凯江)', coord: ["104.460278","31.372500"], itemStyle: {normal: {color: colors.sh}}, },
                    {name: '调元镇(凯江)', coord: ["104.451111","31.375278"], itemStyle: {normal: {color: colors.sh}}, },
                    {name: '调元镇(凯江)', coord:["104.454444","31.373611"], itemStyle: {normal: {color: colors.sh}},},
                    {name: '调元镇(秀水河支沟)', coord: ["104.429167","31.366111"], itemStyle: {normal: {color: colors.sh}},},
                    {name: '调元镇(秀水河)', coord: ["104.439167","31.375833"], itemStyle: {normal: {color: colors.sh}}, },

                    // 水电站

                ],
                '新盛镇': [
                    // 地质灾害
                    {name: '新盛镇木桥村2组郭家沟滑坡', coord: [coordSwitch(104,40,13.14), coordSwitch(31,15,25.01)], itemStyle: {normal: {color: colors.dzzh}}, },

                    //水库
                    {name: '幸福(新盛镇金龙村)', coord: [104.69903, 31.253716],itemStyle: {normal: {color: colors.sk}}, },
                    {name: '战　备(新盛镇土城村)', coord: [104.59761,31.252423],itemStyle: {normal: {color: colors.sk}}, },

                    // 山洪
                    {name: '新盛镇(子金河)', coord: ["104.621111","31.301944"], itemStyle: {normal: {color: colors.sh}}, },

                    //水电站
                    {name: '红旗电站(新盛镇金铃村)', coord: [104.62138778703,31.309213721461],  itemStyle: {normal: {color: colors.sdz}}, },
                    {name: '新盛电站(新盛镇天鹅村)', coord: [104.6268971871,31.2702452479],  itemStyle: {normal: {color: colors.sdz}}, },

                ],
                '鄢家镇': [
                    // 地质灾害
                    {name: '鄢家镇壁山村7组林从辉滑坡', coord: [coordSwitch(104,36,16.04), coordSwitch(31,16,48.89)], itemStyle: {normal: {color: colors.dzzh}}, },

                    //水库
                    {name: '白土地(鄢家镇壁山村)', coord: [104.60530,31.301930],itemStyle: {normal: {color: colors.sk}}, },

                    // 山洪
                    {name: '鄢家镇(凯江支沟)', coord:  ["104.568611","31.250833"], itemStyle: {normal: {color: colors.sh}}, },
                    {name: '鄢家镇(凯江支沟)', coord: ["104.578889","31.286389"], itemStyle: {normal: {color: colors.sh}}, },
                    {name: '鄢家镇(黄水河支沟)', coord: ["104.550278","31.217778"],itemStyle: {normal: {color: colors.sk}}, },

                    //水电站
                    {name: '回龙电站(鄢家镇高垭村)', coord: [104.5467560465,31.2306618347],  itemStyle: {normal: {color: colors.sdz}}, },
                ]
            };
            let allMap = function (t) {
                if (!t) {
                    let arr = []
                    for (let ii in markPointData) {
                        arr.push(markPointData[ii])
                    }
                    document.querySelector('#return-back').style.display = 'none'
                    //   debugger
                    return arr.flat();
                } else {
                    document.querySelector('#return-back').style.display = 'block'
                    //innerHTML='返回上一级'
                    return markPointData[t]
                }
            }
            myChart.setOption({
                title: {
                    text: '安全隐患分布',
                    color: '#fff',
                    x: '20px',
                    y: '20px',
                    // subtext: '人口密度数据来自Wikipedia',
                    textStyle: {
                        color: '#fff'
                    }
                },
                tooltip: {
                    trigger: 'item',
                    formatter: function(params) {
                        if (params.componentType == 'markPoint') {
                            return params.name;
                        } else {
                            return params.data.desc;
                        }
                    }
                },

                geo: {
                    show: true,
                    map: 'LJ',
                    label: {
                        emphasis: {
                            show: false
                        }
                    },
                    roam: false,
                    zoom: 1.2,
                    itemStyle: {
                        normal: {
                            borderColor: '#4085d3',
                            borderWidth: 1.5,
                            shadowColor: '#000',
                            shadowBlur: 50,
                            areaColor: 'rgba(0,0,0,0)',
                        },
                        emphasis: {
                            areaColor: '#4f92fa'  //鼠标移上每一省份的颜色
                        }
                    }
                },

                series: [
                    {
                        type: 'map',
                        mapType: 'LJ', // 自定义扩展图表类型
                        label: {
                            show: true,
                            color: '#cdcdcd'
                        },
                        markPoint: { //图表标注。
                            symbolSize: window.homeSymbolSize,
                            symbol: window.symbolPath,
                            symbolOffset: [0, '-50%'],
                            label: {
                                normal: {
                                    show: true,
                                },
                                emphasis: {
                                    show: true,
                                }
                            },
                            data:allMap(text)
                        },
                        itemStyle: itemStyle,
                        zoom: 1.2,
                        data: [
                            {value: 0, name: '金山镇', desc: '地质灾害隐患20个，全区占比20%<br/>水利隐患点8个，全区占比7%<br/>环保污染源5处，全区占比17%<br/>燃气公司重点巡查区域3处，全区占比10%<br/>加油站3个，全区占比12.5%'},
                            {value: 0, name: '白马关镇', desc: '地质灾害隐患33个，全区占比33%<br/>燃气公司重点巡查区域3处，全区占比9%<br/>水利隐患点28个，全区占比25%<br/>加油站6个 全区占比25%'},
                            {value: 0, name: '万安镇', desc: '地质灾害隐患9个，全区占比9%<br/>水利隐患点15个，全区占比13%<br/>环保污染源16处，全区占比55%<br/>燃气公司重点巡查区域19处，全区占比61%<br/>加油站13个，全区占比54%<br/>威化隐患点8个，全区占比100%'},
                            {value: 0, name: '略坪镇', desc: '地质灾害隐患4个，全区占比4%<br/>水利隐患点28个，全区占比 25%<br/>加油站1个 全区占比4%<br/>环保污染源5处，全区占比17%'},
                            {value: 0, name: '调元镇', desc: '地质灾害隐患12个，全区占比12%<br/>水利隐患点9个，全区占比8%<br/>环保污染源3处，全区占比10%<br/>燃气公司重点巡查区域1处，全区占比3%'},
                            {value: 0, name: '新盛镇', desc: '地质灾害隐患8个，全区占比8%<br/>水利隐患点21个，全区占比19%<br/>环保污染源3处，全区占比10%<br/>燃气公司重点巡查区域2处，全区占比3%<br/>加油站1个，全区占比4%'},
                            {value: 0, name: '鄢家镇', desc: '地质灾害隐患13个，全区占比13%<br/>水利隐患点22个，全区占比20%<br/>环保污染源1处，全区占比3% <br/>燃气公司重点巡查区域3处，全区占比10%<br/>加油站2个，全区占比6%'}
                        ]
                    },
                ]
            }, true);


        });
        document.querySelector('#district').innerHTML=(text || '')
    }
    initData()
    init();
    window.addEventListener("resize", function () {
        myChart.resize();
    });
    myChart.on('click', function (params) { //点击事件
        if (params.componentType === 'markPoint') {

        } else {
           if(!tt){
            initData(params.name)
            init(params.name);
           }
        }
    });
    document.querySelector('#return-back').addEventListener('click', function () {
        initData()
        init();
    })
}
